home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-09-09 | 12.8 KB | 492 lines | [TEXT/CWIE] |
- // A pict file window
- //
- // David Hayward
- // Developer Technical Support
- // AppleLink: DEVSUPPORT
- //
- // Copyrite 1995, Apple Computer,Inc
- //
- // This file contains the getter/setter routines for
- // the PictDocDataHdl fields of a pict file window.
- //
- // 9/13/94 nick first cut
- // 12/13/94 david several modifications
- // 9/25/97 ebb mods to get and set times and pixel counts
-
-
- #include <QDOffScreen.h>
-
- #include "win.h"
- #include "winPictDoc.h"
- #include "winPictDocGetSet.h"
- #include "colorsyncUtils.h"
-
-
- /*------------------------------------------------------------------------------*\
- GetPictDocPict / SetPictDocPict
- *------------------------------------------------------------------------------*
- These routines get and set the Pict field of the PictDocDataHdl
- of the winHandle.
- \*------------------------------------------------------------------------------*/
- PicHandle GetPictDocPict ( winHandle win, short which )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return nil ;
-
- switch (which)
- {
- case kOriginal:
- return (**data).Pict ;
- break ;
- case kMatched:
- return (**data).PictMatched ;
- break ;
- case kProofed:
- return (**data).PictProofed ;
- break ;
- case kChecked:
- return (**data).PictChecked ;
- break ;
- }
- return nil ;
- }
- void SetPictDocPict ( winHandle win, short which, PicHandle thePict )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return ;
-
- switch (which)
- {
- case kOriginal:
- (**data).Pict = thePict ;
- break ;
- case kMatched:
- (**data).PictMatched = thePict ;
- break ;
- case kProofed:
- (**data).PictProofed = thePict ;
- break ;
- case kChecked:
- (**data).PictChecked = thePict ;
- break ;
- }
- }
-
-
- /*------------------------------------------------------------------------------*\
- GetPictDocNeedsUpdate / SetPictDocNeedsUpdate
- *------------------------------------------------------------------------------*
- These routines get and set the PictNeedsUpdate field of the PictDocDataHdl
- of the winHandle.
- \*------------------------------------------------------------------------------*/
- Boolean GetPictDocNeedsUpdate ( winHandle win, short which )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
-
- switch (which)
- {
- case kOriginal:
- return false ;
- break ;
- case kMatched:
- return (**data).PictMatchedNeedsUpdate ;
- break ;
- case kProofed:
- return (**data).PictProofedNeedsUpdate ;
- break ;
- case kChecked:
- return (**data).PictCheckedNeedsUpdate ;
- break ;
- }
- return false ;
- }
- void SetPictDocNeedsUpdate ( winHandle win, short which, Boolean b )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return ;
-
- switch (which)
- {
- case kOriginal:
- break ;
- case kMatched:
- (**data).PictMatchedNeedsUpdate = b ;
- break ;
- case kProofed:
- (**data).PictProofedNeedsUpdate = b ;
- break ;
- case kChecked:
- (**data).PictCheckedNeedsUpdate = b ;
- break ;
- }
- }
-
-
- /*------------------------------------------------------------------------------*\
- GetPictDocDrawTime / SetPictDocDrawTime
- *------------------------------------------------------------------------------*
- These routines get and set the DrawTime field of the PictDocDataHdl
- of the winHandle.
- \*------------------------------------------------------------------------------*/
- unsigned long GetPictDocDrawTime ( winHandle win, short which )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return nil;
-
- switch (which)
- {
- case kOriginal:
- return 0L ;
- break ;
- case kMatched:
- return (**data).MatchTime ;
- break ;
- case kProofed:
- return (**data).ProofTime ;
- break ;
- case kChecked:
- return (**data).CheckTime ;
- break ;
- case kTotal+kMatched:
- return (**data).MatchTotalTime ;
- break ;
- case kTotal+kProofed:
- return (**data).ProofTotalTime ;
- break ;
- case kTotal+kChecked:
- return (**data).CheckTotalTime ;
- break ;
- }
- return 0L ;
- }
- void SetPictDocDrawTime ( winHandle win, short which, unsigned long ticks )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return ;
-
- switch (which)
- {
- case kOriginal:
- break ;
- case kMatched:
- (**data).MatchTime = ticks ;
- break ;
- case kProofed:
- (**data).ProofTime = ticks ;
- break ;
- case kChecked:
- (**data).CheckTime = ticks ;
- break ;
- case kTotal+kMatched:
- (**data).MatchTotalTime = ticks ;
- break ;
- case kTotal+kProofed:
- (**data).ProofTotalTime = ticks ;
- break ;
- case kTotal+kChecked:
- (**data).CheckTotalTime = ticks ;
- break ;
- }
- }
-
- /*------------------------------------------------------------------------------*\
- GetPictDocDrawCount / SetPictDocDrawCount
- *------------------------------------------------------------------------------*
- These routines get and set the DrawCount field of the PictDocDataHdl
- of the winHandle.
- \*------------------------------------------------------------------------------*/
- unsigned long GetPictDocDrawCount ( winHandle win )
- {
- PictDocDataHdl data ;
- unsigned long count = 0;
-
- data = (PictDocDataHdl) GetWinData ( win ) ;
-
- if ( data != nil )
- count = (**data).PixelCount ;
-
- return count;
- }
- void SetPictDocDrawCount ( winHandle win, unsigned long count )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
-
- if ( data != nil )
- (**data).PixelCount = count ;
- }
-
-
-
- /*------------------------------------------------------------------------------*\
- GetPictDocPictRect / SetPictDocPictRect
- *------------------------------------------------------------------------------*
- These routines get and set the PictRect field of the PictDocDataHdl
- of the winHandle.
- \*------------------------------------------------------------------------------*/
- Rect GetPictDocPictRect ( winHandle win )
- {
- PictDocDataHdl data ;
- Rect nilRect = {0,0,0,0} ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return nilRect;
- return (**data).PictRect ;
- }
- void SetPictDocPictRect ( winHandle win, Rect theRect )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return ;
- (**data).PictRect = theRect ;
- }
-
-
- /*------------------------------------------------------------------------------*\
- GetPictDocPaneRect / SetPictDocPaneRect
- *------------------------------------------------------------------------------*
- These routines get and set the PaneRect field of the PictDocDataHdl
- of the winHandle.
- \*------------------------------------------------------------------------------*/
- Rect GetPictDocPaneRect ( winHandle win )
- {
- PictDocDataHdl data ;
- Rect nilRect = {0,0,0,0} ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return nilRect;
- return (**data).PaneRect ;
- }
- void SetPictDocPaneRect ( winHandle win, Rect theRect )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return ;
- (**data).PaneRect = theRect ;
- }
-
-
-
- /*------------------------------------------------------------------------------*\
- GetPictDocPalette / SetPictDocPalette
- *------------------------------------------------------------------------------*
- These routines get and set the Palette field of the PictDocDataHdl
- of the winHandle.
- \*------------------------------------------------------------------------------*/
- PaletteHandle GetPictDocPalette ( winHandle win )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return nil;
- return (**data).Palette ;
- }
- void SetPictDocPalette ( winHandle win, PaletteHandle thePalette )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return ;
- (**data).Palette = thePalette ;
- }
-
-
-
- /*------------------------------------------------------------------------------*\
- GetPictDocCntl / SetPictDocCntl / GetPictDocCntlValue
- *------------------------------------------------------------------------------*
- These routines get and set the ControlHandle fields of the PictDocDataHdl
- of the winHandle.
- \*------------------------------------------------------------------------------*/
- ControlHandle GetPictDocCntl ( winHandle win, short id )
- {
- PictDocDataHdl data ;
- ControlHandle cntl ;
-
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return nil;
-
- switch (id)
- {
- case rPictDocHorzScrollID :
- cntl = (**data).HorzScroll ;
- break ;
- case rPictDocVertScrollID :
- cntl = (**data).VertScroll ;
- break ;
- case rPictDocMatchOnOffID :
- cntl = (**data).MatchOnOff ;
- break ;
- case rPictDocMatchPopupID :
- cntl = (**data).MatchPopup ;
- break ;
- }
- return cntl ;
- }
- void SetPictDocCntl ( winHandle win, short id, ControlHandle cntl )
- {
- PictDocDataHdl data ;
-
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return ;
-
- switch (id)
- {
- case rPictDocHorzScrollID :
- (**data).HorzScroll = cntl ;
- break ;
- case rPictDocVertScrollID :
- (**data).VertScroll = cntl ;
- break ;
- case rPictDocMatchOnOffID :
- (**data).MatchOnOff = cntl ;
- break ;
- case rPictDocMatchPopupID :
- (**data).MatchPopup = cntl ;
- break ;
- }
- }
- short GetPictDocCntlValue ( winHandle win, short id )
- {
- ControlHandle cntl ;
- cntl = GetPictDocCntl ( win, id ) ;
- if ( cntl==nil ) return nil;
- return GetControlValue( cntl ) ;
- }
- void SetPictDocCntlValue ( winHandle win, short id, short val )
- {
- ControlHandle cntl ;
- cntl = GetPictDocCntl ( win, id ) ;
- if ( cntl==nil ) return ;
- SetControlValue( cntl, val ) ;
- }
-
-
-
- /*------------------------------------------------------------------------------*\
- GetPictDocProfile / SetPictDocProfile
- *------------------------------------------------------------------------------*
- These routines get and set the SrceProf, DestProf or PrevProf field of
- the PictDocDataHdl of the winHandle. The which field is not validated
- and must be kSrceProf, kDestProf, or kPrevProf
- \*------------------------------------------------------------------------------*/
- CMProfileRef GetPictDocProfile ( winHandle win, short which )
- {
- PictDocDataHdl data ;
- CMProfileRef prof = nil ;
-
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return nil;
-
- switch (which)
- {
- case kSrceProf :
- prof = (**data).SrceProf ;
- break ;
- case kDestProf :
- prof = (**data).DestProf ;
- break ;
- case kPrevProf :
- prof = (**data).PrevProf ;
- break ;
- }
- return prof ;
- }
-
- void SetPictDocProfile ( winHandle win, short which, CMProfileRef prof )
- {
- PictDocDataHdl data ;
-
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return ;
-
- HLock( (Handle)data ) ;
-
- switch (which)
- {
- case kSrceProf :
- (**data).SrceProf = prof ;
- break ;
- case kDestProf :
- (**data).DestProf = prof ;
- break ;
- case kPrevProf :
- (**data).PrevProf = prof ;
- break ;
- }
- }
-
-
- /*------------------------------------------------------------------------------*\
- GetPictDocProfList / SetPictDocProfList
- *------------------------------------------------------------------------------*
- These routines get and set the ProfList field of the ProfListDataHdl
- of the winRecord.
- \*------------------------------------------------------------------------------*/
- ListHandle GetPictDocProfList ( winHandle win )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return nil;
- return (**data).ProfList ;
- }
- void SetPictDocProfList ( winHandle win, ListHandle list )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return ;
- (**data).ProfList = list ;
- }
-
-
- /*------------------------------------------------------------------------------*\
- GetPictDocListCount / SetPictDocListCount
- *------------------------------------------------------------------------------*
- These routines get and set the ListCount field of the ProfListDataHdl
- of the winRecord.
- \*------------------------------------------------------------------------------*/
- unsigned long GetPictDocListCount ( winHandle win )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return nil;
- return (**data).ListCount ;
- }
- void SetPictDocListCount ( winHandle win, unsigned long count )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return ;
- (**data).ListCount = count ;
- }
-
-
- /*------------------------------------------------------------------------------*\
- GetPictDocDragZones / SetPictDocDragZones
- *------------------------------------------------------------------------------*
- These routines get and set the DragZones field of the DragZonesHdl
- of the winHandle.
- \*------------------------------------------------------------------------------*/
- DragZonesHdl GetPictDocDragZones ( winHandle win )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return nil ;
-
- return (**data).DragZones ;
- }
- void SetPictDocDragZones ( winHandle win, DragZonesHdl theDragZones )
- {
- PictDocDataHdl data ;
- data = (PictDocDataHdl) GetWinData ( win ) ;
- if ( data==nil ) return ;
-
- (**data).DragZones = theDragZones ;
- }
-
-
-
-
-